package com.example.xiaomi.Model.Service;

import com.example.xiaomi.Model.Oop.QRcode;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;



@WebServlet("/code/generation")
public class Code_generation extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher("/WEB-INF/Xiaomi/place_an_order.jsp").forward(req,resp);
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        QRcode code = new QRcode();
        try {
            code.generate();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        req.setAttribute("code","zhifu.jpg");
    }
}

